import UIView from "../../../../quick/core/ui/UIView";
import { inject } from "../../../../quick/defines/Decorators";


const { ccclass, property } = cc._decorator;

@ccclass
export default class TankBattleGameOver extends UIView {

    public static getPrefabUrl() {
        return "prefabs/TankBattleGameOver";
    }

    protected logic : TankBattleLogic = null!;
    @inject("content",cc.Node)
    private content : cc.Node = null!;
    private title : cc.Node = null!;

    onLoad() {
        super.onLoad();
        if ( this.args ){
            this.logic = this.args[0];
        }
        this.title =  cc.find("title", this.content);
    }

    onShow(): void {
        cc.tween(this.title)
        .set({y : this.node.height/2})
        .to(1,{y:0})
        .delay(2)
        .call(()=>{
            this.close();
            if ( this.logic ){
                this.logic.mapClear();
                this.logic.onOpenSlectedView();
            }
        })
        .start();
        super.onShow();
    }
}
